package com.by.controller.goods;

import com.by.bean.goods.Goods;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.goods.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class GoodsController extends BaseController {

    @Autowired
    GoodsService goodsService;

    @GetMapping("/order")
    public ResultBean toOrder(@RequestParam(name = "id") int id,@RequestParam(name = "goodsId") int goodsId) {
        goodsService.toOrder(id, goodsId);
        return success("抢购");
    }

    @GetMapping("/wang")
    public ResultBean get(int id){
        Goods goods = goodsService.get(id);
        return success("11", goods);
    }
}
